package main

/*
类型基础
*/

import (
	"fmt"
	"gotest/utils"

	"github.com/gin-gonic/gin"
)

//go 字符转ASCII 字符转成数字
func test1() {
	var c rune = 'a' //字符类型
	//var s string = "a"
	var i int = 98
	i1 := int(c)
	fmt.Println("'a' convert to", i1)
	c1 := rune(i)
	fmt.Println("98 convert to", string(c1))

	for _, char := range []rune("世界你好") {
		fmt.Println(string(char))
	}
}

//通道
func test2() {
	str := utils.GetRandStr(10)
	fmt.Printf("随机的字符串是:%s", str)
}

type User struct {
	Name string `json:"name",form:"name"`
	Age  int    `json:"age",form:"age"`
}

func main() {
	{

		r := gin.Default()
		r.Handle("GET", "/user", func(ctx *gin.Context) {
			ctx.Writer.Write([]byte(ctx.FullPath()))

		})
		r.GET("/Hello", func(ctx *gin.Context) {

		})
		r.Run(":8080")
	}
	//test2()
	/*test1()
	ch := 'b'
	fmt.Println(ch / 1)*/
}
